package com.humh.library.v2.model;


import com.humh.library.model.InventoryManagement;
import com.humh.library.model.Librarian;
import com.humh.library.model.Reader;
import java.util.HashMap;
import java.util.Map;

//图书馆上下文
public class LibraryContext {

  private InventoryManagement inventoryManagement;
  private com.humh.library.model.Librarian librarian;
  private Map<String, com.humh.library.model.Reader> readers;

  public LibraryContext(InventoryManagement inventoryManagement, com.humh.library.model.Librarian librarian) {
    this.inventoryManagement = inventoryManagement;
    this.librarian = librarian;
    readers =new HashMap<>();
  }

  /**
   * 获取图书库存管理对象
   * @return
   */
  public InventoryManagement getInventoryManagement() {
    return inventoryManagement;
  }

  /**
   * 获取图书管理员对象
   * @return
   */
  public Librarian getLibrarian() {
    return librarian;
  }

  /**
   * 添加读者信息
   * @param reader
   */
  public void addReader(com.humh.library.model.Reader reader) {
    readers.put(reader.getReaderId(), reader);
  }

  /**
   * 获取读者信息
   * @param readerId
   * @return
   */
  public Reader getReaderById(String readerId) {
    return readers.get(readerId);
  }
}
